<!DOCTYPE html>
<html>
    <head>
        <!-- 页面meta -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>传智健康</title>
        <meta name="description" content="传智健康">
        <meta name="keywords" content="传智健康">
        <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
        <!-- 引入样式 -->
        <link rel="stylesheet" href="plugins/elementui/index.css">
        <link rel="stylesheet" href="css/login.css">
    </head>
    <body class="hold-transition skin-purple sidebar-mini">
        <div id="app">
            <div class="login-container">
                <div class="loginBox">
                  <form method="post" class="login-form" action="/login.do" label-position="left">
                      <div class="title-container">
                        <div class="logoInfo clearfix">
                          <em class="logo"></em>
                        </div>
                      </div>
                      <div>
                        <span class="svg-container svg-container_login">
                          <span class="user"></span>
                        </span>
                        <input type="text" v-model="username" name="username" placeholder="请输入用户名" />
                      </div>
                      <div>
                        <span class="svg-container">
                          <span class="username"></span>
                        </span>
                        <input type="password" v-model="password" name="password" placeholder="请输入密码"/>
                      </div>
                      <input type="submit" style="width:100%;margin-bottom:30px;" value="登录"></input>
                </form>
                </div>
              </div>
        </div>
    </body>
    <!-- 引入组件库 -->
    <script src="js/jquery.min.js"></script>
    <script src="js/vue.js"></script>
    <script src="js/axios-0.18.0.js"></script>
    <script src="plugins/elementui/index.js"></script>
    <script>
        //获取指定的URL参数值 http://localhost/pages/setmeal_detail.html?id=3
        function getUrlParam(paraName) {
            var url = document.location.toString();
            //alert(url);
            var arrObj = url.split("?");
            if (arrObj.length > 1) {
                var arrPara = arrObj[1].split("&");
                var arr;
                for (var i = 0; i < arrPara.length; i++) {
                    arr = arrPara[i].split("=");
                    if (arr != null && arr[0] == paraName) {
                        return arr[1];
                    }
                }
                return "";
            }
            else {
                return "";
            }
        }
    </script>
    <script>
       new Vue({
            el: '#app',
            data:{
                username:null,
                password:null
            },
           created() {
               //[]和{}区别
               this.backViewForLogin();
           },
            methods: {
                backViewForLogin(){
                    axios.get("/user/backViewForLogin.do").then((res)=>{
                        if(res.data.flag){
                            this.$message.success(res.data.message);
                            this.username = res.data.data.username;
                            this.password = res.data.data.password;
                        }else {
                            this.$message.error(res.data.message);
                        }
                    });
                }
            }
        })

    </script>
</html>
